package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

/**
 * 商品表
 */
@Getter@Setter
public class Product extends BaseDomain{
    //精美礼品
    public static final Long SIGN_PRODUCT = 888L;
    private ProductType productType;

    private String name;

    private Integer salePrice;

    private String img;
    private String intro;
    private int statu;

    public String getJsonString(){
        HashMap<Object, Object> map = new HashMap<>();
        map.put("id", id);
        if (productType != null) {
            map.put("productTypeId", productType.getId());
        }
        map.put("name", name);
        map.put("salePrice", salePrice);
        map.put("img", img);
        map.put("intro", intro);
        map.put("statu", statu);
        return JSONUtil.toJSONString(map);
    }

    public String getStatuDisplay(){
        if(statu==0){
            return "正常";
        }
        if(statu==1){
            return "推荐";
        }
        return "";
    }
}